﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vowei.Core.Models;
using Vowei.Data.Helpers;

namespace Vowei.Data.Models
{
    public partial class Ticket : ITicket, ICommentable, IStatus
    {
        public Ticket()
        {
            this.FillDefaultProperties();
        }

        public virtual void Close()
        {
            ClosedDate = DateTime.Now;

            // TODO: 将这个改成从数据库中读取用户自定义的关闭标记
            Status = "Completed";
        }

        IQueryable<IComment> ICommentable.Comments
        {
            get { return Comments.AsQueryable<IComment>(); }
        }

        public void AddComment(IComment comment)
        {
            Comments.Add((Comment)comment);
        }

        public void RemoveComment(IComment comment)
        {
            Comments.Remove((Comment)comment);
        }

        public void ReActive()
        {
            throw new NotImplementedException();
        }
    }
}
